package changgou.test;

import org.springframework.security.crypto.bcrypt.BCrypt;

/**
 * @author : jam.chen
 * @Project : changgou_parent
 * @ClassName : testBcrypt
 * @PackageName : changgou.test
 * @date : 2020/7/19  22:53
 * @Version : 1.0
 */
public class  testBcrypt {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            String gensalt = BCrypt.gensalt();  //获取盐
            System.out.println("盐："+gensalt);  //输出盐

            String saltPassword = BCrypt.hashpw("123456",gensalt);  //密码，用盐进行加密
            System.out.println("密文："+saltPassword);
            System.out.println("=======================");
            System.out.println(BCrypt.checkpw("1234560", saltPassword)); //对密码行进校验。
            System.out.println("************************");
        }

    }
}
